//
//  GYHomeDealingVC.m
//  GYDemo
//
//  Created by Mrzhang on 2018/4/3.
//  Copyright © 2018年 mac. All rights reserved.
//

//
//                .-~~~~~~~~~-._       _.-~~~~~~~~~-.
//            __.'              ~.   .~              `.__
//          .'//                  \./                  \\`.
//        .'//                     |                     \\`.
//      .'// .-~"""""""~~~~-._     |     _,-~~~~"""""""~-. \\`.
//    .'//.-"                 `-.  |  .-'                 "-.\\`.
//  .'//______.============-..   \ | /   ..-============.______\\`.
//.'______________________________\|/______________________________`.
//
//

#import "GYHomeDealingVC.h"
#import "Head.h"
@interface GYHomeDealingVC ()
@property(nonatomic,strong)UIView* topView;
@end

@implementation GYHomeDealingVC
#pragma mark - getter and setter
#pragma mark - event
#pragma mark - method
#pragma mark - life
#pragma mark - getter and setter
-(UIView *)topView
{
    if (!_topView) {
        _topView=[[UIView alloc] init];
        _topView.frame=WFCGRectMake(0, 0, 375, 40);
        _topView.backgroundColor = RGBACOLOR(245, 245, 245, 1);
        float ww=375/5;
        for (int i=0; i<5; i++)
        {
            UILabel *titleLab_1 = [[UILabel alloc] init];
            titleLab_1.frame = WFCGRectMake(ww*i, 0, ww, _topView.height);
            titleLab_1.textColor = Main_Color_LightGray;
            titleLab_1.font = SYSTEMFONT(14);
            titleLab_1.textAlignment = NSTextAlignmentCenter;
            titleLab_1.text = i==0?@"产品种类":i==1?@"地区":i==2?@"数量":i==3?@"价格":@"成交时间";
            [_topView addSubview:titleLab_1];
        }
    }
    return _topView;
}
#pragma mark - event
#pragma mark - method
-(void)initTopView
{
    
}
#pragma mark - life
- (void)viewDidLoad {
    [super viewDidLoad];
    self.title=@"实时成交";
    self.edgesForExtendedLayout = UIRectEdgeNone;
    self.automaticallyAdjustsScrollViewInsets = NO;
    self.view.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:self.topView];
    
    self.baseTable.separatorStyle=UITableViewCellSeparatorStyleSingleLine;
    self.baseTable.backgroundColor=[UIColor whiteColor];
    self.baseTable.y=WFCGFloatY(40);
    self.baseTable.height=self.baseTable.height-GY_Nav_height-40;
    [self.view addSubview:self.baseTable];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - UITableViewDelegate
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    //return 20;
    return _sourceArr.count;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    return WFCGFloatY(40);
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellID = @"CellIDThird";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellID];
    if (cell == nil) {
        cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellID];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        cell.backgroundColor=[UIColor whiteColor];
        
    }
    [cell.contentView removeAllSubviews];
    NSDictionary* dic=_sourceArr[indexPath.row];
    float ww=375/5;
    for (int i=0; i<5; i++)
    {
        NSString* address=dic[@"region"];
      address=  [address stringByReplacingOccurrencesOfString:@"省" withString:@""];
      address=  [address stringByReplacingOccurrencesOfString:@"市" withString:@""];
        
        UILabel *titleLab_1 = [[UILabel alloc] init];
        titleLab_1.frame = WFCGRectMake(ww*i, 0, ww, 40);
        titleLab_1.textColor = Main_Color_Gray;
        titleLab_1.font = SYSTEMFONT(14);
        titleLab_1.textAlignment = NSTextAlignmentCenter;
        titleLab_1.text = i==0?dic[@"protype"]:i==1?address:i==2?dic[@"transnum"]:i==3?dic[@"price"]:dic[@"time"];
        [cell.contentView addSubview:titleLab_1];
       // dic[@"region"],dic[@"protype"],dic[@"price"],dic[@"time"]]
    }
    return cell;
}

@end


/*
 11111111111111111111111111111111111111001111111111111111111111111
 11111111111111111111111111111111111100011111111111111111111111111
 11111111111111111111111111111111100001111111111111111111111111111
 11111111111111111111111111111110000111111111111111111111111111111
 11111111111111111111111111111000000111111111111111111111111111111
 11111111111111111111111111100000011110001100000000000000011111111
 11111111111111111100000000000000000000000000000000011111111111111
 11111111111111110111000000000000000000000000000011111111111111111
 11111111111111111111111000000000000000000000000000000000111111111
 11111111111111111110000000000000000000000000000000111111111111111
 11111111111111111100011100000000000000000000000000000111111111111
 11111111111111100000110000000000011000000000000000000011111111111
 11111111111111000000000000000100111100000000000001100000111111111
 11111111110000000000000000001110111110000000000000111000011111111
 11111111000000000000000000011111111100000000000000011110001111111
 11111110000000011111111111111111111100000000000000001111100111111
 11111111000001111111111111111111110000000000000000001111111111111
 11111111110111111111111111111100000000000000000000000111111111111
 11111111111111110000000000000000000000000000000000000111111111111
 11111111111111111100000000000000000000000000001100000111111111111
 11111111111111000000000000000000000000000000111100000111111111111
 11111111111000000000000000000000000000000001111110000111111111111
 11111111100000000000000000000000000000001111111110000111111111111
 11111110000000000000000000000000000000111111111110000111111111111
 11111100000000000000000001110000001111111111111110001111111111111
 11111000000000000000011111111111111111111111111110011111111111111
 11110000000000000001111111111111111100111111111111111111111111111
 11100000000000000011111111111111111111100001111111111111111111111
 11100000000001000111111111111111111111111000001111111111111111111
 11000000000001100111111111111111111111111110000000111111111111111
 11000000000000111011111111111100011111000011100000001111111111111
 11000000000000011111111111111111000111110000000000000011111111111
 11000000000000000011111111111111000000000000000000000000111111111
 11001000000000000000001111111110000000000000000000000000001111111
 11100110000000000001111111110000000000000000111000000000000111111
 11110110000000000000000000000000000000000111111111110000000011111
 11111110000000000000000000000000000000001111111111111100000001111
 11111110000010000000000000000001100000000111011111111110000001111
 11111111000111110000000000000111110000000000111111111110110000111
 11111110001111111100010000000001111100000111111111111111110000111
 11111110001111111111111110000000111111100000000111111111111000111
 11111111001111111111111111111000000111111111111111111111111100011
 11111111101111111111111111111110000111111111111111111111111001111
 11111111111111111111111111111110001111111111111111111111100111111
 11111111111111111111111111111111001111111111111111111111001111111
 11111111111111111111111111111111100111111111111111111111111111111
 11111111111111111111111111111111110111111111111111111111111111111
 
 
 */
